/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 *
 */
package Matricula_Nota;

import javax.swing.DefaultListSelectionModel;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Pedro
 */
public class VistaAlumnoSeccion extends javax.swing.JDialog {

    private Coordinador coordinador;
    private Seccion seccion;
    private DefaultTableModel mdlAlumnoSeccion;

    /** Creates new form VistaSeccion */
    public VistaAlumnoSeccion(javax.swing.JDialog parent, boolean modal, Coordinador coordinador, Seccion seccion) {
        super(parent, modal);
        initComponents();
        this.coordinador = coordinador;
        this.seccion = seccion;
        mdlAlumnoSeccion = (DefaultTableModel) tblAlumnoSeccion.getModel();
        tblAlumnoSeccion.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
        mostrarSecciones();
    }

    private void mostrarSecciones() {
        mdlAlumnoSeccion.setRowCount(seccion.getAlumnos().size());
        for (int i = 0; i < seccion.getAlumnos().size(); i++) {
            Alumno alumno = seccion.getAlumnos().get(i);
//            if (coordinador.getSecciones().get(i).getEstado() == 1) {
            mdlAlumnoSeccion.setValueAt(alumno.getCodigo(), i, 0);
            mdlAlumnoSeccion.setValueAt(alumno.getNombre(), i, 1);
//            }
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblAlumnoSeccion = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Mantenimiento de Secciones");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Listado de Alumnos"));

        tblAlumnoSeccion.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Código", "Nombre"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(tblAlumnoSeccion);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable tblAlumnoSeccion;
    // End of variables declaration//GEN-END:variables
}
